const TokenKey = 'maple-leaves-token'
const userInfo = 'maple-leaves-user-info'

export function getToken() {
  return localStorage.getItem(TokenKey) || ''
}

export function setToken(token: string) {
  return localStorage.setItem(TokenKey, token)
}

export function removeToken() {
  return localStorage.removeItem(TokenKey)
}

export function getUserInfo() {
  return JSON.parse(localStorage.getItem(userInfo) || '{}')
}

export function setUserInfo(user: object) {
  return localStorage.setItem(userInfo, JSON.stringify(user))
}

export function removeUserInfo() {
  return localStorage.removeItem(userInfo)
}
